<?=$this->header(true)?>


    <?=$this->menu("galleries")?>


    <h1><?=$this->message("label.header", _Gallery::BUNDLE)?></h1>


    <? /* Breadcrums route */ ?>
    <?=$this->route(
        array(
            array(
                "name"=>$this->message("label.header", _Gallery::BUNDLE),
                "href"=>"gallery/list"
            ),
            array(
                "name"=>($this->galleryForm->getGallery()->getGalleryId() > 0 ?
                    $this->message("route.edit", _Core::BUNDLE) . " " .
                        "\"".$this->galleryForm->getGallery()->getName()."\" " :
                    $this->message("route.new", _Core::BUNDLE) . " " . $this->message("label.item", _Gallery::BUNDLE))
            )
        )
    )?>


    <? /* Show error messages */ ?>
    <?=$this->errors(null, _Gallery::BUNDLE)?>


    <form id="<?=get_class($this->galleryForm)?>" action="gallery/save" method="post" enctype="multipart/form-data">

        <div>
            <input type="hidden"
                   name="gallery->galleryId"
                   value="<?=$this->galleryForm->getGallery()->getGalleryId()?>" />
        </div>

        <fieldset>

            <legend><?=$this->message("label.required", _Core::BUNDLE)?></legend>

            <table cellspacing="0" cellpadding="0" class="form">
            <tr class="ctrl<?=$this->error("gallery->name")?>">
                <th><label for="gallery_name"><?=$this->message("prompt.name", _Gallery::BUNDLE)?></label></th>
                <th class="required"><em>*</em></th>
                <td>
                    <input name="gallery->name"
                           id="gallery_name"
                           value="<?=$this->galleryForm->getGallery()->getName()?>"
                           maxlength="255"
                           type="text"
                           class="textInput" />
                </td>
            </tr>
            </table>

        </fieldset>

        <? /*
        <fieldset>

            <legend><?=$this->message("label.optional", _Core::BUNDLE)?></legend>

            <table cellspacing="0" cellpadding="0" class="form">
            <tr class="ctrl<?=$this->error("gallery->description")?>">
                <th><label for="gallery_description"><?=$this->message("prompt.description", _Gallery::BUNDLE)?></label></th>
                <th class="required"><em>&nbsp;</em></th>
                <td>
                    <textarea name="gallery->description"
                              id="gallery_description"
                              mce_editable="true"><?=$this->galleryForm->getGallery()->getDescription()?></textarea>
                </td>
            </tr>
            <tr class="ctrl<?=$this->error("formImage")?>">
                <th><label for="formImage"><?=$this->message("label.image", _Core::BUNDLE)?></label></th>
                <th class="required"><em>&nbsp;</em></th>
                <td>
                    <? if(!is_null($this->galleryForm->getGallery()) &&
                        $this->galleryForm->getGallery()->getImageId() > 0 &&
                        !is_null($this->galleryForm->getGallery()->getImageRelatedByImageId())) { ?>

                        <input type="hidden"
                               name="gallery->imageRelatedByImageId->imageId"
                               value="<?=$this->galleryForm->getGallery()->getImageId()?>" />
                        <input type="hidden"
                               name="gallery->imageRelatedByThumbnailId->imageId"
                               value="<?=$this->galleryForm->getGallery()->getThumbnailId()?>" />

                        <input type="hidden"
                               name="gallery->imageRelatedByImageId->binaryFileId"
                               value="<?=$this->galleryForm->getGallery()->getImageRelatedByImageId()->getBinaryFileId()?>" />
                        <input type="hidden"
                               name="gallery->imageRelatedByThumbnailId->binaryFileId"
                               value="<?=$this->galleryForm->getGallery()->getImageRelatedByThumbnailId()->getBinaryFileId()?>" />

                        <img src="image?id=<?=$this->galleryForm->getGallery()->getImageId()?>"
                             width="<?=$this->galleryForm->getGallery()->getImageRelatedByImageId()->getWidth()?>"
                             height="<?=$this->galleryForm->getGallery()->getImageRelatedByImageId()->getHeight()?>" alt="" />

                        <input type="checkbox" name="deleteImage" value="true" id="deleteImage" /> <label for="deleteImage"><?=$this->message("label.image.delete", _Core::BUNDLE)?></label>

                        <br /><br />

                    <? } ?>

                    <input type="file" name="formImage" />

                    <p class="hint"><?=$this->message("note.image.resize", _Core::BUNDLE)?> <?=$this->imageProps($this->param(_Core::SETTING_LIST))->getImageWidth()?>x<?=$this->imageProps($this->param(_CORE::SETTING_LIST))->getImageHeight()?>.</p>

                </td>
            </tr>
            </table>

        </fieldset>

        */ ?>

        <div class="buttons">

            <input type="button"
                   onclick="to('gallery/list')"
                   value="<?=$this->message("button.cancel", _Core::BUNDLE)?>"
                   class="button" />
            <input type="submit"
                   value="<?=$this->message("button.submit", _Core::BUNDLE)?>"
                   class="button" />

        </div>

    </form>

<?=$this->footer()?>